package com.sh.common.core.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum SzpnUserLevelEnum {

    /**
     * 普通用户
     */
    NORMAL(0, ""),

    /**
     * V1
     */
    V1(1, "V1"),

    /**
     * V2
     */
    V2(2, "V2"),

    /**
     * V3
     */
    V3(3, "V3"),

    /**
     * V4
     */
    V4(4, "V4"),

    /**
     * V5
     */
    V5(5, "V5"),

    /**
     * V6
     */
    V6(6, "V6"),

    /**
     * V7
     */
    V7(7, "V7"),

    /**
     * V8
     */
    V8(8, "V8"),

    /**
     * V9
     */
    V9(9, "V9"),

    /**
     * V10
     */
    V10(10, "V10"),

    /**
     * V11
     */
    V11(11, "V11"),

    /**
     * V12
     */
    V12(12, "V12"),

    /**
     * V13
     */
    V13(13, "V13"),

    /**
     * V14
     */
    V14(14, "V14"),

    /**
     * V15
     */
    V15(15, "V15"),
    ;


    private final Integer code;
    private final String info;

    public static SzpnUserLevelEnum of(Integer code) {
        for (SzpnUserLevelEnum value : values()) {
            if (ObjectUtil.equals(code, value.getCode())) {
                return value;
            }
        }
        throw new RuntimeException("'UserLevel' not found By " + code);
    }
}
